package com.jyxd.web.controller.basic;

import com.jyxd.web.data.basic.MonitorLifeData;
import com.jyxd.web.data.dto.HttpResult;
import com.jyxd.web.service.assessment.basic.MonitorLifeDataService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping(value = "/monitor_life_data")
public class MonitorLifeDataController {

    @Autowired
    private MonitorLifeDataService monitorLifeDataService;

    @ApiOperation("新增一条监护仪数据")
    @RequestMapping(value = "/insert", method = RequestMethod.PUT)
    @ResponseBody
    public boolean insert(MonitorLifeData monitorData) {
        return monitorLifeDataService.insert(monitorData);
    }

    @ApiOperation("查询单挑数据")
    @RequestMapping(value = "/queryData", method = RequestMethod.POST)
    @ResponseBody
    public MonitorLifeData queryData(String id) {
        return monitorLifeDataService.queryData(id);
    }

    @ApiOperation("查询数据列表")
    @RequestMapping(value = "/queryList", method = RequestMethod.POST)
    @ResponseBody
    public HttpResult queryList(MonitorLifeData monitorLifeData) {
        return monitorLifeDataService.queryList(monitorLifeData);
    }

    @ApiOperation("查询患者最新监护仪数据")
    @RequestMapping(value = "/queryNewestList", method = RequestMethod.POST)
    @ResponseBody
    public HttpResult queryNewestList(@RequestBody MonitorLifeData monitorLifeData) {
        return monitorLifeDataService.queryNewestList(monitorLifeData);
    }

    @ApiOperation("查询数据数量")
    @RequestMapping(value = "/queryNum", method = RequestMethod.POST)
    @ResponseBody
    public int queryNum(Map<String, Object> map) {
        return monitorLifeDataService.queryNum(map);
    }

    @ApiOperation("删除部分数据")
    @RequestMapping(value = "/deleteData", method = RequestMethod.DELETE)
    @ResponseBody
    public boolean deleteData(Map<String, Object> map) {
        return monitorLifeDataService.deleteData(map);
    }

    @ApiOperation("根据时间获取生命体征信息")
    @RequestMapping(value = "/getDataByTime", method = RequestMethod.POST)
    @ResponseBody
    public HttpResult getDataByTime (@RequestBody Map<String, Object> map) { ;
        return monitorLifeDataService.getDataByTime(map);
    }


}
